/****************************************************
	文件：Decorator.cs
	作者：HuskyT
	邮箱：1005240602@qq.com
	日期：2020/5/15 23:19:34
	功能：装饰器
*****************************************************/

namespace AIBehavior
{
    public abstract class Decorator : IEntity
    {
        protected IEntity mEntity;
        protected AIData mData;

        public Decorator(AIData data)
        {
            mData = data;
            Init(data);
        }

        /// <summary>
        /// 装饰
        /// </summary>
        public void Decorate(IEntity entity)
        {
            mEntity = entity;
        }
        /// <summary>
        /// 执行行为
        /// </summary>
        public void Do()
        {
            if (mEntity != null)
            {
                mEntity.Do();
            }
            DoSelf();
        }
        public abstract void Init(AIData data);
        protected abstract void DoSelf();
    }
}
